<script type="text/javascript">
	wx.config({
		debug: false,
		appId: "{BEESCRM:$appid}",
		timestamp: "{BEESCRM:$timestamp}",
		nonceStr: "{BEESCRM:$noncestr}",
		signature: "{BEESCRM:$signature}",
		jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','hideOptionMenu','scanQRCode'],
	});
	
	wx.ready(function(){
		var url = '{BEESCRM:$share_url}';
		var imgUrl = '{BEESCRM:$share_image}';
		var title = '{BEESCRM:$share_title}';
		var desc = '{BEESCRM:$share_desc}';
		//分享到朋友圈
		wx.onMenuShareTimeline({
			title: title, // 分享标题
			link: url, // 分享链接
			imgUrl: imgUrl, // 分享图标
			success: function () { 
				share(); 
			},
			cancel: function () { 
				// 用户取消分享后执行的回调函数
				/* alert('已取消'); */
			}
		});
		//发送给好友
		wx.onMenuShareAppMessage({
			title: title, // 分享标题
			desc: desc, // 分享描述
			link: url, // 分享链接
			imgUrl: imgUrl, // 分享图标
			type: '', // 分享类型,music、video或link，不填默认为link
			dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
			success: function () { 
				// 用户确认分享后执行的回调函数
				share();
			},
			cancel: function () { 
				// 用户取消分享后执行的回调函数
			}
		});
	});
	
	//分享点亮体验点需要全局url
	var act_id='{BEESCRM:$act_id}';
	var wechat_id='{BEESCRM:$wechat_id}';
	var fans_id='{BEESCRM:$fans_id}';
	var route='{BEESCRM:$route}';
	var origin='{BEESCRM:$origin}';
	var action_name='{BEESCRM:$action_name}';
	var point_id='{BEESCRM:$point_id}';
	if(!origin){
		origin='wechat';
	}
	var share_callback_url="/activity/footprint/share/act_id/"+act_id+"/wechat_id/"+wechat_id+"/fans_id/"+fans_id+"/action_name/"+action_name+"/route/"+route+"/origin/"+origin;
	if(point_id){
		share_callback_url+='/point_id/'+point_id;
	}
	var share_callback_url_extend;
	//分享log
	function share(){
		var url;
		url=share_callback_url;
		if(share_callback_url_extend){
			url+=share_callback_url_extend;
		}
		$.ajax({
			type:'post',
			dataType:'json',
			url:url,
			success:function(data){
				if(data.url){
					location.href=data.url;
				}
			}
		});
	}  
</script>
	